<?php
class RecordModel extends Model {

    public function __construct() {
        parent::__construct();
        $this->tables = array(DB_FREFIX.'record');
        $this->fields = array('id','name','goodsid','user','num','price','date','attr');
        list(
            $this->R['id'],
            $this->R['goodsid']
        ) = $this->getRequest()->getParams(array(
            isset($_GET['id']) ? $_GET['id'] : null,
            isset($_GET['goodsid']) ? $_GET['goodsid'] : null,
            )
        );
    }

    public function ajaxGetRecord() {
        $condition = array("goodsid='{$_POST['id']}'");
        echo json_encode(parent::select($this->tables,array('id','name','attr','user','price','num','date'),array('where'=>$condition,'limit'=>$_POST['limit'],'order'=>'date DESC')));
    }

    public function ajaxGetRecordNum() {
        $condition = array("goodsid='{$_POST['id']}'");
        echo parent::total(array('where'=>$condition));
    }




}



?>